Can the UK Civil Service propose legislation or direct legislation?
Are there rules governing how the Civil Service can behave in this regard?
No. The civil service works for Ministers to develop and implement legislation. Only MPs can propose new laws.
However when the government is drafting legislation to present to parliament, they will use civil servants to help with the drafting process. In practice, ministers depend on the civil service to work out the details of new legislation. But the civil service is non-political, and the same civil servants will continue to serve under multiple political leaders.
The civil service is subject to the Civil Service Code, which are the rules for how civil servants should behave. Among the Prime Minister's roles is being "Minister for the Civil Service" so she provides ultimate oversight in the running of the service